﻿/***********************************************************************
 * <copyright file="WindowBaseExtension.cs" company="BUCA JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   LinhMC
 * Email:    linhmc@buca.vn
 * Website:
 * Create Date: Thursday, November 14, 2013
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/

using System;
using System.Web.Mvc;

namespace EasyUIMvc.Window
{
    public class WindowBaseExtension : ExtensionBase
    {
        private readonly WindowSettings _settings;
        private MvcHtmlString _content;

        public WindowBaseExtension(WindowSettings settings)
        {
            _settings = settings;
        }
        public WindowBaseExtension Content(string content)
        {
            _content = MvcHtmlString.Create(content);
            return this;
        }

        public override string GetScripts()
        {
            throw new NotImplementedException();
        }

        public override MvcHtmlString GetHtml()
        {
            var window = GetTopTag("div", "easyui-window", _settings);
            window.MergeAttribute("style", _settings.Style);
            window.MergeAttribute("title", _settings.Title);
            window.InnerHtml += _content;
            return MvcHtmlString.Create(window.ToString());
        }
    }
}
